package com.snowflake.ecatalog.entity;

import java.util.Date;

import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;

/**
 * 统一定义操作者的entity基类.
 * 
 * 基类统一定义创建人、创建时间、最近修改人、最近修改时间的属性名称、数据类型、列名映射及生成策略.
 * 
 */
//JPA 基类的标识
@MappedSuperclass
public abstract class OpEntity extends IdEntity {

	protected User creator;
	protected Date createdTime;        
	protected User lastModifier;
	protected Date lastModifiedTime;
	
	// JPA 基于creator列的多对一关系定义
	@ManyToOne
	@JoinColumn(name = "creator")
	public User getCreator() {
		return creator;
	}
	public void setCreator(User creator) {
		this.creator = creator;
	}
	public Date getCreatedTime() {
		return createdTime;
	}
	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}
	
	// JPA 基于last_modifier列的多对一关系定义
	@ManyToOne
	@JoinColumn(name = "last_modifier")
	public User getLastModifier() {
		return lastModifier;
	}
	public void setLastModifier(User lastModifier) {
		this.lastModifier = lastModifier;
	}
	public Date getLastModifiedTime() {
		return lastModifiedTime;
	}
	public void setLastModifiedTime(Date lastModifiedTime) {
		this.lastModifiedTime = lastModifiedTime;
	}
}
